package com.aigis.big4.tmp.javase.thread.queue;

import com.aigis.big4.tmp.javase.thread.User;

import java.util.concurrent.BlockingQueue;

public class ConsumerQueue implements Runnable {

    private BlockingQueue<User> conQueue;

    public ConsumerQueue(BlockingQueue conQueue) {
        this.conQueue = conQueue;
    }

    @Override
    public void run(){
        try{
            while (true){
                User u=conQueue.take();
                System.out.println("消费"+u.toString());
                Thread.sleep(1000);
            }
        }catch (InterruptedException e){
            e.printStackTrace();
        }
    }
}
